﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
</head>
<body>
<input type="text" name="userName" id="userName" value="" placeholder="userName"/>
<input type="password" name="password" id="password" value="" placeholder="password" onkeyup="login()"/>
</body>
<script src="js/jquery-1.9.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/common.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">
    function login() {
        var name = $("#userName").val();
        var pw = $("#password").val();
        if (pw.length == 2) {
            $.ajax({
                type: "post",
                url: adr + "/login/pass",
                async: true,
                data: {
                    userId: name,
                    pass: pw
                },
                success: function (data) {
                    if (data.status == 200) {
                        alert('ok');
                        console.log(data);
                        window.location.href = adr + "/login/setck?token=" + data.data;
                    }
                    else {
                        alert("登陆失败");
                        document.getElementById("password").value = '';
//                      pw = '';
                    }

                }

            });
        }
        else {

        }
    }
</script>
</html>
